﻿<paging:MtPage x:Name="PageRoot"
                     x:Class="SampleWindowsStoreApp.Views.LocalizationPage"
                     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                     xmlns:paging="using:MyToolkit.Paging"
                     xmlns:converters="using:MyToolkit.Converters"
                     xmlns:viewModels="using:SampleWindowsStoreApp.ViewModels"
                     mc:Ignorable="d">

    <paging:MtPage.Resources>
        <viewModels:LocalizationPageModel x:Key="ViewModel" />
        <converters:DateTimeConverter x:Key="Dtc" />
    </paging:MtPage.Resources>

    <Grid DataContext="{StaticResource ViewModel}" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.ChildrenTransitions>
            <TransitionCollection>
                <EntranceThemeTransition/>
            </TransitionCollection>
        </Grid.ChildrenTransitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="120"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <Button Margin="39,59,39,0" Command="{Binding Frame.GoBackCommand, ElementName=PageRoot}"
                    Style="{StaticResource NavigationBackButtonNormalStyle}" VerticalAlignment="Top"
                    AutomationProperties.Name="Back" AutomationProperties.AutomationId="BackButton" 
                    AutomationProperties.ItemType="Navigation Button"/>

            <TextBlock Style="{StaticResource SubheaderTextStyle}" Text="Windows 8 and MyToolkit Sample App" Margin="0,50,0,10" Grid.Column="1" />
            <TextBlock Text="Localization" Style="{StaticResource HeaderTextBlockStyle}" Grid.Column="1" 
                       TextWrapping="NoWrap" VerticalAlignment="Bottom" Margin="0,100,0,0"/>
        </Grid>

        <StackPanel Grid.Row="1" Margin="120,60,40,40">
            <!-- Translated strings in .resw files -->
            <TextBlock Text="Localized TextBlock" Style="{StaticResource BasicTextStyle}" FontWeight="Bold" Margin="0,0,0,5" />
            <TextBlock x:Uid="LocalizedTextBlock" Text="Design Time Text" HorizontalAlignment="Left"
                       Style="{StaticResource BasicTextStyle}" Margin="0,0,0,10" />
            
            <TextBlock Text="Edit the .resw files in the 'Localization' directory to change the localization." 
                       Style="{StaticResource BasicTextStyle}" Margin="0,0,0,20" />

            <!-- DateTimeConverter -->
            <TextBlock Text="Localized DateTime using the MyToolkit DateTimeConverter" 
                       Style="{StaticResource BasicTextStyle}" FontWeight="Bold" Margin="0,0,0,5" />
            <TextBlock Text="{Binding Now, Converter={StaticResource Dtc}}" Style="{StaticResource BasicTextStyle}" Margin="0,0,0,20" />
            
            <Button Content="Access translated string in code" Click="OnAccessTranslatedStringInCode" />
        </StackPanel>
    </Grid>
</paging:MtPage>
